#include <iostream>

class Test
{
public:
    Test()
    {
        p = new int;
        std::cout<<"构造函数\n";
    }
    ~Test()
    {
        delete p;
        std::cout<<"析构函数\n";
    }
    Test(const Test &t)
    {
        std::cout<<"拷贝构造\n";
        
        p = new int;
        *p = *t.p;
    }

private:
    int * p;

};

Test func()
{
    Test t;
}

int main() 
{
    // Test t;
    // Test t2 = t;

    //Test();//匿名对象:生命周期只有一行代码
    Test t = Test();
    std::cout<<"--------\n";

    return 0;
}